var AjaxMethod = require("../getAjax.js"); 
var ajax = new  AjaxMethod;
export default{
    state:{
    	data_orderDatInfo:{},
    	data_orderPrev:{}, // 订单预览详情
    	orderLlistAll:{}, // 订单全部列表
    	orderLlistDFK:{}, // 订单代付款列表
    	orderLlistDXF:{}, // 订单代销费列表
    	orderLlistDPJ:{}, // 订单待评价列表
    },
    mutations:{
    	//订单详情预览
    	set_orderPreview:function(state,{list}){
    		state.data_orderPrev = list;
    	},
    	//订单全部列表
    	set_allOrderListAll:function(state,{list}){
    		state.orderLlistAll = list;
    	},
    	set_allOrderListDFK:function(state,{list}){
			state.orderLlistDFK = list;
		},
		set_allOrderListDXF:function(state,{list}){
			state.orderLlistDXF = list;
		},
		set_allOrderListDPJ:function(state,{list}){
			state.orderLlistDPJ = list;
		},
    },
    actions:{
    	//订单详情预览
    	get_orderDetInfo:function(context,vm){

    		var Atype = "post", 
                //Aurl = baseUrl+'/products/'+_goodId+'.html',
                Aurl = baseUrl+"/orders/info.html?REQUEST_JSON={visitChannel:2,pageIndex:1,CURRENCY:'CNY',commandInfo:{idList:[{id:"+vm.data_gouwucheId+"}]}}";
            ajax.getJson(Atype,Aurl,function(res){
                console.log(res)
                //if(){}
                context.commit("set_orderPreview",{list:res.data}) // 乘客信息
                // context.commit("set_cartlist",{list:res.data.cartInfo.cartListVOs[0].cartList});
            },function(err){
                console.log(err)
            },function(){
                //context.state.Ajaxing = true; // 加载中显示...
            })
    	},
    	//订单全部列表
    	get_orderList:function(context){
    		var Atype = "post", 
                //Aurl = baseUrl+'/products/'+_goodId+'.html',
                Aurl = baseUrl+"/members/orderList.html?REQUEST_JSON={visitChannel:2,pageIndex:1,CURRENCY:'CNY',commandInfo:{orderState:"+''+"}}";
            ajax.getJson(Atype,Aurl,function(res){
                console.log(res)
                //if(){}
                //context.commit("set_orderList",{list:res.data}) // 乘客信息
                context.commit("set_allOrderListAll",{list:res.data});
				context.commit("set_allOrderListDFK",{list:res.data});
				context.commit("set_allOrderListDXF",{list:res.data});
				context.commit("set_allOrderListDPJ",{list:res.data});
                // context.commit("set_cartlist",{list:res.data.cartInfo.cartListVOs[0].cartList});
            },function(err){
                console.log(err)
            },function(){
                //context.state.Ajaxing = true; // 加载中显示...
            })
    	},
    	//提交订单
    	get_commitOrder:function(context,vm){
    		var Atype = "post", 
                //Aurl = baseUrl+'/products/'+_goodId+'.html',
                Aurl = baseUrl+"/orders/orderCommit.html?REQUEST_JSON={visitChannel:2,pageIndex:1,CURRENCY:'CNY',commandInfo:{payCode:'"+vm.payCode+"',payName:'"+vm.payName+"',addressId:12,idList[{id:"+257+"}]}}";
            ajax.getJson(Atype,Aurl,function(res){
                console.log(res)
                //if(){}
                //context.commit("set_orderList",{list:res.data}) // 乘客信息
    //             context.commit("set_allOrderListAll",{list:res.data});
				// context.commit("set_allOrderListDFK",{list:res.data});
				// context.commit("set_allOrderListDXF",{list:res.data});
				// context.commit("set_allOrderListDPJ",{list:res.data});
                // context.commit("set_cartlist",{list:res.data.cartInfo.cartListVOs[0].cartList});
            },function(err){
                console.log(err)
            },function(){
                //context.state.Ajaxing = true; // 加载中显示...
            })
    	}
    }
}